const arr = [[1,2],[3,4,5],[[6,7,[8,9,10]]],[11,12,13,14,15]]
function flattenArray(arr) {
    return arr.reduce((result, item) => {
        console.log(item)
        if(Array.isArray(item)) {
            console.log('item', result.concat(flattenArray(item)))
            return result.concat(flattenArray(item))
        }else {
            return result.concat(item)
        }
    }, [])
}

flattenArray(arr)